import redis
from pymongo import MongoClient

pool2 = redis.ConnectionPool(host='localhost', port=6379, db=0, decode_responses=True)
r2 = redis.Redis(connection_pool=pool2)
# while True:
#     ids = r2.rpoplpush("jingdong_goods_queue", "jingdong_goods_queue")


import pymongo
#
# client = MongoClient(host='localhost', port=27017)  # 连接mongodb端口
# db = client['jingdong']
# mongo_collection = db['goods_info']  # crowd表格
#
# cnt = mongo_collection.count()
# print(cnt)
# for i  in mongo_collection.find():
#     print(i['_id'].split("_")[0])
#     r2.sadd("jingdong_set",i['_id'].split("_")[0])

while True:
    i = r2.spop("jingdong_set")
    print(i)
    r2.lpush("jingdong_goods_queue", i)
